package com.jin.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jin.sys.domain.Datas;
import org.apache.ibatis.annotations.Select;

/**
 *  Mapper 接口
 *
 * @author Jin
 * @since 2021-04-13
 */
public interface DatasMapper extends BaseMapper<Datas> {

    //当前系统学生数
    @Select("SELECT COUNT(*) FROM `user`")
    public Integer getStudentNumber();

    //当前学生请假记录数
    @Select("SELECT COUNT(*) FROM `leaves` where sid=${id}")
    public Integer getLeaveNumberBySid(Integer id);

    //当前学生待销假记录数
    @Select("SELECT COUNT(*) FROM `leaves` where sid=${id} and `status`=2")
    public Integer getUnBackOutLeaveNumberBySid(Integer id);

    //当前待审批记录数-班主任
    @Select("SELECT COUNT(*) FROM `leaves` where mgr=${id} and `status`=0")
    public Integer getUnApproveLeaveNumberByMgr(Integer id);

    //当前待审批记录数-辅导员、院领导
    @Select("SELECT COUNT(*) FROM `leaves` where deptid=${deptid} and `status`=0")
    public Integer getUnApproveLeaveNumberByDeptId(Integer deptid);

}
